<?php
//define('CMSPAD_DEBUG', true);
$_CONFIG = array();
require_once('./kernel/global.php');
$dispatcherClass = cmspad_import('Dispatcher');
$dispatcher = new $dispatcherClass();
if($_SERVER['REQUEST_METHOD'] == 'POST'){
	cmspad_import('Controller');
	$controller = Controller::getInstance();
	$controller->processRequests();
}else{
	if(isset($_CONFIG['SYSTEM']['USE_GZIP']) && 
		 $_CONFIG['SYSTEM']['USE_GZIP'] === true &&
		 extension_loaded('zlib') &&
		 strstr($_SERVER['HTTP_ACCEPT_ENCODING'],'gzip')){
		ob_start('ob_gzhandler'); 	
	}else{
		ob_start();
	}
	$dispatcher->dispatch(isset($_SERVER['ORIG_PATH_INFO'])?$_SERVER['ORIG_PATH_INFO']:(isset($_SERVER['PATH_INFO'])?$_SERVER['PATH_INFO']:''));
	ob_end_flush();
}
?>